<!-- header.html -->
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header navbar-collapse">
            <a class="navbar-brand active" href="/">亿云EIP系统</a>
        </div>
        <div>
            <ul class="nav navbar-nav nav-tabs navbar-collapse">
                <li><a href="/business">客户信息</a></li>
                <li><a href="/business/circuit_order">线路业务</a></li>
                <li><a href="/business/ticket">Ticket系统</a></li>
                <li><a href="/office">资产管理</a></li>
                <li><a href="/files">内部文档</a></li>
            </ul>
        </div>
        <div>
            <p class="navbar-text navbar-right">
                欢迎，{{ username }}
                <a href="/changepassword">修改密码</a>
                <a href="/logout">注销登录</a>
            </p>
        </div>
        <div>
            <form id="search_form" action="{% url "search_customer" %}" method="post" class="navbar-form navbar-right" role="search">
                {% csrf_token %}
                <div class="form-group">
                    <input type="text" id="search" class="form-control" name="customer" placeholder="联系人或客户名称的关键词">
                </div>
                <div class="form-group">
                    <select name="search_type" id="search_type" class="form-control">
                        <option>搜索客户</option>
                        <option>搜索线路订单</option>
                        <option>搜索设备</option>
                    </select>
                </div>
                <script>
                    $(document).ready(function () {
                        $('#search_type').change(function () {
                            var _selected = $(this).children('option:selected').val();
                            var _search = $("#search");
                            var _search_form = $("#search_form");
                            if ( _selected === '搜索客户' ) {
                                _search.prop({
                                    name: "customer",
                                    placeholder: "联系人或客户名称的关键词"});
                                _search_form.prop("action", '{% url "search_customer" %}');
                            } else if ( _selected === '搜索线路订单' ) {
                                _search.prop({
                                    name: "circuit",
                                    placeholder: "线路编号或客户名称的关键词"});
                                _search_form.prop("action", '{% url "search_circuit_order" %}');
                            } else if ( _selected === '搜索设备' ) {
                                _search.prop({
                                    name: "equipment",
                                    placeholder: "设备编号或客户名称的关键词"});
                                _search_form.prop("action", '{% url "search_equipment" %}');
                            }
                    })})
                </script>
                <button type="submit" class="btn btn-default">搜索</button>
            </form>
        </div>
    </div>
</nav>